package com.feige.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * @author feige<br />
 * @ClassName: WebMvcConfig <br/>
 * @Description: <br/>
 * @date: 2021/6/6 13:31<br/>
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {



    @Autowired
    private MyHandlerMethodArgumentResolver myHandlerMethodArgumentResolver;

    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {

        resolvers.add(myHandlerMethodArgumentResolver);
    }

//    @Override
//    public void addCorsMappings(CorsRegistry registry) {
//        // 所有请求，也可配置成特定请求，如/api/**
//        String mapping = "/**";
//        // 所有来源，也可以配置成特定的来源才允许跨域，如http://www.xxxx.com
//        String origins = "*";
//        // 所有方法，GET、POST、PUT等
//        String methods = "*";
//        registry.addMapping(mapping).allowedOrigins(origins).allowedMethods(methods);
//    }
}
